Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GCC9][Werror]fix -Werror=maybe-uninitialized #52265

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

engineer1109
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Describe

新出现的-Werror=maybe-uninitialized 错误
务必记得phi::vectorize 套用dims

auto in_dims = phi::vectorize(in->dims());

不用vectorize 就会报错Werror

auto in_dims = in->dims();

Log

[ 79%] Building CXX object paddle/fluid/operators/detection/CMakeFiles/roi_perspective_transform_op.dir/roi_perspective_transform_op.cc.o
/media/wjl/D2/github/fork/10/Paddle/paddle/fluid/operators/detection/roi_perspective_transform_op.cc: In member function ‘void paddle::operators::CPUROIPerspectiveTransformOpKernel<T>::Compute(const paddle::framework::ExecutionContext&) const [with T = float]’:
/media/wjl/D2/github/fork/10/Paddle/paddle/fluid/operators/detection/roi_perspective_transform_op.cc:262:9: error: ‘*((void*)& in_dims +24)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  262 |     int in_width = in_dims[3];
      |         ^~~~~~~~
/media/wjl/D2/github/fork/10/Paddle/paddle/fluid/operators/detection/roi_perspective_transform_op.cc:261:9: error: ‘*((void*)& in_dims +16)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  261 |     int in_height = in_dims[2];
      |         ^~~~~~~~~
/media/wjl/D2/github/fork/10/Paddle/paddle/fluid/operators/detection/roi_perspective_transform_op.cc:259:10: error: ‘*((void*)& in_dims +8)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  259 |     auto in_dims = in->dims();

@paddle-bot
Copy link

paddle-bot bot commented Mar 29, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@engineer1109
Copy link
Contributor Author

#47143

@engineer1109
Copy link
Contributor Author

@zhiqiu CI 已经结束

@@ -256,7 +256,7 @@ class CPUROIPerspectiveTransformOpKernel : public framework::OpKernel<T> {
auto transformed_width = ctx.Attr<int>("transformed_width");
auto spatial_scale = ctx.Attr<float>("spatial_scale");

auto in_dims = in->dims();
auto in_dims = phi::vectorize(in->dims());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto in_dims = phi::vectorize(in->dims());
const auto & in_dims = in->dims()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhiqiu 已经修改,本地编译通过

Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1 luotao1 merged commit 74d87a6 into PaddlePaddle:develop Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants